// JavaScript Document

/**
 * @author : AgnesXu;
 * @date : 2016-12-14 14:32;
 * @used : inde;
 */ 

 //环形图
var ring = echarts.init(document.getElementById('ring'));
var dataStyle = {
    normal: {
        label: {show:false},
        labelLine: {show:false}
    }
};
var placeHolderStyle = {
    normal : {
        color: '#eee',
        label: {show:false},
        labelLine: {show:false}
    },
    emphasis : {
        color: '#ddd'
    }
};
option = {
    title: {
        text: '资源使用情况',
        x: 'center',
        y: 'center',
        itemGap: 20,
        textStyle : {
            color : 'rgba(30,144,255,0.8)',
            fontFamily : '微软雅黑',
            fontSize : 16
        }
    },
    tooltip : {
        show: true,
        formatter: "{a} <br/>{b} : {c} ({d}%)"
    },
    legend: {
        orient : 'vertical',
        x : 420, /* document.getElementById('ring').offsetWidth / 3 */
        y : 45,
        itemGap:12,
        data:['云主机','虚拟内核','内存(GB)','内网FIP','安全组','云硬盘','卷存储(GB)'],
    },
    toolbox: {
        show : true,
        feature : {
            mark : {show: true},
            dataView : {show: true, readOnly: false},
            restore : {show: true},
            saveAsImage : {show: true}
        }
    },
    color:["#847cc5","#61b9ff","#02baf0","#73b748","#959801","#ffb400","#e75d2f"],
    series : [
        {
            name:'1',
            type:'pie',
            clockWise:false,
            radius : [110, 125],
            itemStyle : dataStyle,
            data:[
                {
                    value:68,
                    name:'云主机'
                },
                {
                    value:32,
                    name:'云主机剩余',
                    itemStyle : placeHolderStyle,
                }
            ]
        },
        {
            name:'2',
            type:'pie',
            clockWise:false,
            radius : [95, 110],
            itemStyle : dataStyle,
            data:[
                {
                    value:29, 
                    name:'虚拟内核'
                },
                {
                    value:71,
                    name:'虚拟内核剩余',
                    itemStyle : placeHolderStyle
                }
            ]
        },
        {
            name:'3',
            type:'pie',
            clockWise:false,
            radius : [80, 95],
            itemStyle : dataStyle,
            data:[
                {
                    value:3, 
                    name:'内存(GB)'
                },
                {
                    value:97,
                    name:'内存(GB)剩余',
                    itemStyle : placeHolderStyle
                }
            ]
        },
        {
            name:'4',
            type:'pie',
            clockWise:false,
            radius : [65, 80],
            itemStyle : dataStyle,
            data:[
                {
                    value:3, 
                    name:'内网FIP'
                },
                {
                    value:97,
                    name:'内网FIP剩余',
                    itemStyle : placeHolderStyle
                }
            ]
        },
        {
            name:'5',
            type:'pie',
            clockWise:false,
            radius : [50, 65],
            itemStyle : dataStyle,
            data:[
                {
                    value:3, 
                    name:'安全组'
                },
                {
                    value:97,
                    name:'安全组剩余',
                    itemStyle : placeHolderStyle
                }
            ]
        },
        {
            name:'6',
            type:'pie',
            clockWise:false,
            radius : [35, 55],
            itemStyle : dataStyle,
            data:[
                {
                    value:3, 
                    name:'云硬盘'
                },
                {
                    value:97,
                    name:'云硬盘剩余',
                    itemStyle : placeHolderStyle
                }
            ]
        },
        {
            name:'7',
            type:'pie',
            clockWise:false,
            radius : [20,35],
            itemStyle : dataStyle,
            data:[
                {
                    value:3, 
                    name:'卷存储(GB)'
                },
                {
                    value:97,
                    name:'卷存储(GB)剩余',
                    itemStyle : placeHolderStyle
                }
            ]
        }
    ]
};

ring.setOption(option);

